//
//  BLNavigatonViewController.m
//  百思不得姐
//
//  Created by hbl on 16/3/14.
//  Copyright © 2016年 hbl. All rights reserved.
//

#import "BLNavigatonViewController.h"

@interface BLNavigatonViewController ()

@end

@implementation BLNavigatonViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    }


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0) {
        UIButton *backBtn = [[UIButton alloc]init];
        [backBtn setImage:[UIImage imageNamed:@"navigationButtonReturnClick"] forState:UIControlStateHighlighted];
        [backBtn setImage:[UIImage imageNamed:@"navigationButtonReturn"] forState:UIControlStateNormal];
        [backBtn setTitle:@"返回" forState:UIControlStateNormal];
        [backBtn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
        [backBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        
        [backBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
        
        backBtn.bounds = CGRectMake(0, 0, 70, 30);
        backBtn.contentEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
        backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backBtn];
        
       viewController.hidesBottomBarWhenPushed = YES;
        
    }
    [super pushViewController:viewController animated:animated];
     viewController.navigationController.interactivePopGestureRecognizer.delegate = nil;
    
}

- (void)back
{
    [self popViewControllerAnimated:YES];
}

@end
